package com.lwj.designpattern.create.factory;

import com.lwj.designpattern.create.factory.entity.BlackCar;
import com.lwj.designpattern.create.factory.entity.Car;
import com.lwj.designpattern.create.factory.entity.YellowCar;

import java.util.HashMap;
import java.util.Map;

/**
 *工厂方法模式
 * @author wujilee
 * @date 2022/11/15
 */
public class FactoryFunction {
    public static void main(String[] args) {

    }
    public Car  getCa(String color){
        CarFactory carFactory = null;
        if(color.equals("black")){
            carFactory = new BlackCarFactory();
        }
        if(color.equals("yellow")){
            carFactory = new YellowCarFactory();
        }
        return carFactory.createCar();
    }
}


